package com.zhengqing.design.action.interpreter._01.expression.impl;

import com.zhengqing.design.action.interpreter._01.Context;
import com.zhengqing.design.action.interpreter._01.expression.Expression;

/**
 * <p> 加法表达式实现类 </p>
 *
 * @author zhengqingya
 * @description
 * @date 2022/12/22 13:53
 */
public class PlusOperation extends NonTerminalExpression {
    public PlusOperation(Expression e1, Expression e2) {
        super(e1, e2);
    }

    @Override
    public int interpreter(Context context) {
        // 将两个表达式相加
        return this.e1.interpreter(context) + this.e2.interpreter(context);
    }
}
